-
Notifications
You must be signed in to change notification settings - Fork 0
chore: #27 CI workflow on the self-hosted runner #34
Conversation
dfbd714 to
8e2dadb
Compare
|
Note on the two runs above: Run 1 (failed, 12s): Fix: this PR is now stacked on After #32 merges, retarget this PR to Or merge #32 first and reopen this against |
|
You mention that the new runner has the project2 label, but I noticed both jobs use only [self-hosted, linux, x64]. Would it make sense to include project2 in runs-on as well, especially for the deploy job, to make sure it runs on the intended runner? |
Two jobs, both on [self-hosted, linux, x64] since NTNU GitHub Enterprise has no hosted runners. quality (every PR and every push to main): pnpm install --frozen-lockfile, then format:check, lint, typecheck, test, build, and a client bundle budget gate at 512 kB per JS chunk. deploy (push to main only): builds with the production settings and publishes client/dist to /var/www/html/project2, then curls the site to confirm it served. Restarts crate-api only if the unit exists, so the deploy works today at M1 and still works when the backend lands in M2. The bundle budget is a bærekraft measure: it is deliberately loose now and tightens as the app grows, so a dependency cannot quietly double our payload without CI noticing. Co-Authored-By: opencode <noreply@opencode.ai>
Found in review of #34: both jobs used [self-hosted, linux, x64] even though the runner is labelled project2. That works today because the Project 2 runner is repo-scoped and is the only one that can pick up these jobs, but it is not what the labels are for. The two jobs now differ deliberately: - quality is unpinned beyond the platform. It is a pure function of the checked-out tree, so it can run on any self-hosted runner we add later without editing this file. - deploy is pinned to [self-hosted, linux, x64, project2]. It writes to /var/www/html/project2 and restarts crate-api, both of which only exist on it2810-19. If a second runner is ever registered to this repo from a different machine, this job must not land there. Reported by rachelks. Co-Authored-By: opencode <noreply@opencode.ai>
8e2dadb to
6ab73b6
Compare
|
You are right, and the label was doing no work as written. Fixed. The two jobs now differ deliberately:
Today it happened to be safe because the Project 1 runner is repo-scoped to So your instinct about pinning the deploy job specifically was the right half of it. I left quality unpinned on purpose, and said so in a comment in the workflow so the next person does not "helpfully" add the label to both. |
Found by actually verifying rather than assuming: PR #34 targets feat/1-repo-tooling because it is stacked on #32, and the workflow's `pull_request: branches: [main]` filter silently skipped CI for it. The push of 6ab73b6 produced no run at all. Stacked PRs are how we are working (see docs/WORKFLOW.md), so a branch filter on pull_request is wrong. pull_request now has no filter and runs for every PR whatever it targets; push stays limited to main so we only deploy from the mainline. Co-Authored-By: opencode <noreply@opencode.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-reviewed after the changes. The runner distinction makes sense to me, and all checks pass locally as well. Looks good!
The workflow is on main for the first time. PR #34 merged into feat/1-repo-tooling (its base at the time) after #32 had already merged that branch into main, so the workflow never reached main and the repo has been running with no CI at all. This brings it across. Content is unchanged from what #34 reviewed and what has been passing on the runner: quality job (format, lint, typecheck, test, build, bundle budget) on every PR and every push to main, deploy job on push to main only. Two fixes that came out of actually running it: - pull_request has no branch filter. A `branches: [main]` filter meant stacked PRs like #34, which targets feat/1-repo-tooling, silently got zero CI runs. - deploy is pinned to [self-hosted, linux, x64, project2]. It writes to /var/www/html/project2 and restarts crate-api, which only exist on it2810-19. quality stays unpinned so any future runner can pick it up. Co-Authored-By: opencode <noreply@opencode.ai>
What this does
Adds the CI workflow for #27. NTNU's GitHub Enterprise has no hosted runners, so both jobs run on the self-hosted runner on the group VM. A second runner,
it2810-19-project2, is registered to this repo alongside the existing Project 1 one.Jobs
qualityruns on every PR and every push tomain:deployruns on push tomainonly, afterqualitypasses. Publishesclient/distto/var/www/html/project2and curls the site to confirm it served. It restartscrate-apionly if that systemd unit exists, so the deploy works today at M1 and still works when the backend lands in M2.What was done
.github/workflows/ci.ymlwith the two jobs aboveit2810-19-project2as a self-hosted runner on the VM (separate from the Project 1 runner, which is repo-scoped toT19-Project-1)actions/checkoutpluspnpm/action-setupandsetup-nodewith pnpm cachingWhat was tested
gh api repos/.../actions/runnersreportsit2810-19-project2with labelsself-hosted, Linux, X64, project2feat/1-repo-toolingbranch:format:check,lintwith 0 warnings,typecheck,test(3 tests),buildThe runner is not yet running as a service, so CI will show it offline until that is installed. That is one
sudocommand and is called out in the PR comments.Notes on choices
deployskipscrate-apiif absent rather than failing. Otherwise every push tomainwould be red until M2, which trains people to ignore CI.T19-Project-1and will not pick up this repo's jobs. Keeping them separate means a long P1 build cannot block us.Closes
Closes #27.